function main_TLS_AIA(I, data_filepath, filename, algorithmsName, iters)
    iFrames = length(I);
    [M, N] = size(I{1,1});
    I_ = zeros(M, N, iFrames);
    for f = 1:iFrames
        I_(:,:,f) = I{f,1};
    end
    delta = [0, pi/2+0.01, pi+0.02,3*pi/2+0.03,0+0.04,pi/2+0.05, pi, 3*pi/2];
    Sk = sin(delta);  % 
    Ck = cos(delta);
    
    clip = 1:1:iFrames;
    I_ = I_(:,:,clip);Sk = Sk(clip);Ck = Ck(clip);delta = delta(clip);
    [M,N,kI] = size(I_);
    % 使用AIA 计算包裹相位与未知相移量
    % 关于方向的定义  条纹向左  物体向右    设左为正方向
    block_size_row = 10; 
    block_size_col = 60;
    block_row_num = M/block_size_row;
    block_col_num = N/block_size_col;
    block_row_num = floor(block_row_num);
    block_col_num = floor(block_col_num);
    phi=zeros(M,N);Amp=zeros(M,N);B=zeros(M,N);
    tic
    r=1;
    
    for n = 1:iters
        for i=1:block_row_num
            for j=1:block_col_num
                if i==block_row_num 
                    Mr = M;
                else
                    Mr = (i)*block_size_row;
                end
                if j==block_col_num 
                    Nc = N;
                else 
                    Nc = (j)*block_size_col;
                end
                Ib = I_((i-1)*block_size_row+1:Mr,(j-1)*block_size_col+1:Nc,:);
                [y,A,ind] = constructEqu3(Ib,delta);
                [mb,nb,~] = size(Ib);
                if isempty(y) 
                    phi((i-1)*block_size_row+1:Mr,(j-1)*block_size_col+1:Nc) = nan;
                    Amp((i-1)*block_size_row+1:Mr,(j-1)*block_size_col+1:Nc) = nan;
                    B((i-1)*block_size_row+1:Mr,(j-1)*block_size_col+1:Nc) = nan;
                    continue;
                end
                         
                X = tls(A,y);          
                
    
                Ta = ones(size(Ib(:,:,1)))*nan;
                Tb = ones(size(Ib(:,:,1)))*nan;
                Tc = ones(size(Ib(:,:,1)))*nan;
                [x,y] = ind2sub(size(Ib(:,:,1)), ind);
    
                a = X(1,:);
                Ta(sub2ind(size(Ta),x,y)) = a;
                b = X(2,:);
                Tb(sub2ind(size(Tb),x,y)) = b;
                c = X(3,:);
                Tc(sub2ind(size(Tc),x,y)) = c;
                Ta = reshape(Ta,mb,nb);
                phib = atan2(-Tc,Tb);
                phib=reshape(phib,mb,nb);
                Bb = sqrt(Tb.^2+Tc.^2);Bb=reshape(Bb,mb,nb);
                phi((i-1)*block_size_row+1:Mr,(j-1)*block_size_col+1:Nc) = phib;
                Amp((i-1)*block_size_row+1:Mr,(j-1)*block_size_col+1:Nc) = Ta;
                B((i-1)*block_size_row+1:Mr,(j-1)*block_size_col+1:Nc) = Bb;
                r=r+1;
            end
        end
        I2 = reshape(I_,M*N,kI);
        if delta(2) > 1
            phi=-phi;
        end
        
        [Sk,Ck,delta] = steps2(I_,phi);
    end
    toc
    saveFile(I, Amp, B, phi, delta, data_filepath, filename, algorithmsName);
end





